Skip to content

Conversation

@mguttmann
Copy link

@mguttmann mguttmann commented Jan 17, 2026

Summary

Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop.

Closes #9070

Features

CLI Support

Method Usage
Flag opencode --yolo or opencode --dangerously-skip-permissions
Environment Variable OPENCODE_YOLO=true opencode
Commands opencode yolo status / enable / disable
# Check current status
$ opencode yolo status
YOLO mode: ENABLED (saved in config)
Config: /Users/.../.config/opencode/config.json

# Enable permanently
$ opencode yolo enable
YOLO mode ENABLED - saved to config
Warning: All permission prompts will be skipped!

# Disable
$ opencode yolo disable
YOLO mode disabled - removed from config

Desktop App Support

New Settings → Danger Zone tab with:

  • This Session Only - Toggle for current session (resets on restart)
  • Always Enabled - Persists to ~/.config/opencode/config.json
  • Clear visual indicators showing active state
  • Live switching without app restart
  • Warning messaging about the risks

Config File Support

{
  "yolo": true
}

Works in both project-level opencode.json and global ~/.config/opencode/config.json.

Technical Implementation

  • Yolo Module (packages/opencode/src/yolo/index.ts): Centralized state management
  • Permission Bypass (permission/next.ts): Auto-approves in PermissionNext.ask() when YOLO enabled
  • API Endpoints: GET/POST /config/yolo for runtime control
  • Safety: Explicit deny rules are still respected even in YOLO mode

Files Changed

File Changes
packages/opencode/src/yolo/index.ts New module for YOLO state management
packages/opencode/src/cli/cmd/yolo.ts New CLI commands
packages/opencode/src/permission/next.ts Auto-approve logic
packages/opencode/src/server/routes/config.ts YOLO API endpoints
packages/opencode/src/flag/flag.ts OPENCODE_YOLO env var
packages/opencode/src/config/config.ts Config schema
packages/opencode/src/index.ts CLI flag + command registration
packages/app/src/components/dialog-settings.tsx Desktop UI (Danger Zone tab)

Testing

Manually tested:

  • CLI --yolo flag
  • CLI opencode yolo commands
  • Environment variable
  • Desktop UI YOLO toggles
  • Config persistence
  • Live toggle without restart
  • Permission prompts appear when disabled
  • Permission prompts skipped when enabled
  • Switching between session-only and permanent modes

Related Issues

This PR provides a comprehensive solution that addresses:

gwizz and others added 14 commits January 16, 2026 16:30
Non-network errors seen in logs:

- AI_APICallError (402 deactivated_workspace)

- AI_APICallError (500 server_error)

- AI_LoadAPIKeyError / OpenAI API key is missing

- ProviderInitError

- ConfigInvalidError

- ProviderAuthOauthCallbackFailed

- NotFoundError

- EditBuffer is destroyed
- Add getUsage() to fetch OAuth account status and health
- Add fetchAnthropicUsage() to fetch Claude Max rate limits from Anthropic API
- Add GET /auth/usage endpoint to expose usage data
- Add DialogAuthUsage component with rate limit visualization
- Display Anthropic 5-hour and 7-day limits with progress bars
- Show OAuth account status, cooldown state, and request counts
- Add button in sidebar to open the dialog
- Add AuthUsageCommand to display rate limit info in terminal
- Show account status, cooldown state, and request counts
- Display Anthropic rate limits when available
The AI SDK's convertToModelMessages() does not accept 'step-start' as a valid
UIMessagePart type. This caused AI_InvalidPromptError during session compaction.

- Remove step-start from being added to UIMessage parts
- Simplify the filter since step-start is no longer included
- Fixes compaction breaking sessions with context overflow
## Summary
Implements comprehensive multi-account OAuth support with automatic rate limit
rotation, manual account switching, and a new Settings menu for the desktop app.

## Features

### Multi-Account OAuth Rotation (Backend)
- Add `Auth.OAuthPool.setActive()` to manually switch active OAuth account
- Add `Auth.OAuthPool.snapshot()` returns `activeID` for credential selection
- Update `rotating-fetch.ts` to prefer `activeID` while keeping auto-rotation
- Update `fetchAnthropicUsage()` to respect `provider.active[namespace]`
- Update `getAccounts()` to correctly identify active account

### API Endpoints
- Add `POST /auth/active` endpoint to switch active OAuth account
- Returns updated `anthropicUsage` for immediate UI updates

### Desktop App - Settings Menu
- New `DialogSettings` component with tabbed interface
- **Providers Tab**: View connected providers, add new providers with search
- **Provider Detail View**: Account list, usage stats, switch functionality
- **About Tab**: GitHub, docs, Discord links, keyboard shortcuts
- Inline provider search without leaving settings context

### Desktop App - Context Panel
- Add Anthropic Rate Limits section in session context panel
- Shows 5-hour, weekly (all models), weekly (sonnet) usage bars
- Account switch buttons when multiple accounts configured
- Only visible when current session uses Anthropic provider

### CLI Enhancements
- `opencode auth usage`: Shows individual usage per OAuth account
- `opencode auth switch`: Interactive command to switch active account
- `opencode auth list`: Shows account count per provider
- All provider lists now sorted alphabetically

## Technical Details

### Files Changed
- `packages/opencode/src/auth/index.ts`: Core OAuth pool functions
- `packages/opencode/src/auth/rotating-fetch.ts`: Credential selection
- `packages/opencode/src/server/server.ts`: API endpoint
- `packages/opencode/src/cli/cmd/auth.ts`: CLI commands
- `packages/app/src/components/dialog-settings.tsx`: New settings UI
- `packages/app/src/components/session/session-context-tab.tsx`: Context panel
- `packages/app/src/pages/layout.tsx`: Settings button integration

### Auto-Rotation Flow
1. Request uses `activeID` (manually selected or first available)
2. On 429 rate limit → account gets cooldown, moved to back
3. Next request automatically uses next available account
4. Manual switch via UI/CLI updates `provider.active[namespace]`

### Anthropic Usage Stats
Currently only Anthropic provides OAuth usage statistics.
Other providers show multi-account switching but no usage bars.
Contributions welcome for additional provider support.
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potential duplicate:

PR #7137: feat: add --dangerously-skip-permissions flag
#7137

This PR appears to be directly related as it implements a --dangerously-skip-permissions flag, which is one of the methods mentioned in PR #9073 for skipping permission prompts. The current PR #9073 consolidates this feature under the broader "YOLO mode" umbrella with additional functionality for Desktop UI and runtime configuration.

Note: PR #6968 mentions "Autonomous Mode" in the documentation context but appears less directly related to the implementation.

@mguttmann
Copy link
Author

Thanks for flagging PR #7137!

Comparison of the two implementations:

Feature PR #7137 (surma) PR #9073 (this PR)
CLI --dangerously-skip-permissions ✅ (+ --yolo alias)
Environment variable
TUI warning indicator ✅ (Desktop "ACTIVE" badge)
CLI commands (yolo status/enable/disable)
Desktop UI (Settings → Danger Zone)
Config file support ("yolo": true)
Runtime API (GET/POST /config/yolo)
Session vs Permanent modes
Live toggle without restart

Summary:

If PR #7137's simpler approach is preferred, the maintainers could merge that instead. However, this PR provides a more complete solution that addresses all related feature requests (#8463, #7928, #1813) with full parity between CLI and Desktop.

Happy to consolidate or adjust based on maintainer feedback!

@freak4pc
Copy link

This is such a needed addition IMO, thanks for pushing it!

@mguttmann
Copy link
Author

mguttmann commented Jan 17, 2026

Added ability to delete individual OAuth accounts

Update: This feature has been moved to PR #9069 (Multi-Account OAuth) where it logically belongs. See my comment below for details.

@iljod
Copy link
Contributor

iljod commented Jan 18, 2026

Added ability to delete individual OAuth accounts:

* **CLI**: `opencode auth logout` now shows account selection for multi-account providers

* **Desktop**: Delete button (X) with confirmation for each account in Provider settings

* **API**: `DELETE /auth/account` endpoint

This was a missing feature - you could add multiple accounts but couldn't remove them individually.

imo not the scope of this pr, should be a different one

- Add Auth.OAuthPool.removeRecord() to remove individual OAuth accounts
- Add DELETE /auth/account API endpoint for Desktop app
- Update CLI 'opencode auth logout' to select specific accounts
- Add delete button with confirmation in Desktop Provider settings
@mguttmann
Copy link
Author

Good catch @iljod! You're absolutely right - the delete account functionality doesn't belong in this PR.

I've moved it to PR #9069 (Multi-Account OAuth) where it logically belongs. The delete feature is needed for managing multiple OAuth accounts, not for YOLO mode.

Changes made:

This PR now focuses purely on YOLO mode functionality.

Implements comprehensive YOLO mode for both CLI and Desktop:

CLI:
- --yolo / --dangerously-skip-permissions flag
- OPENCODE_YOLO environment variable
- 'opencode yolo status/enable/disable' commands

Desktop:
- Settings → Danger Zone tab with clear UI
- Session-only toggle (resets on restart)
- Permanent toggle (saves to ~/.config/opencode/config.json)
- Live switching without app restart

Config:
- 'yolo: true' in opencode.json or global config

Technical:
- Yolo module manages state across CLI and server
- PermissionNext.ask() auto-approves when YOLO is enabled
- Explicit deny rules still respected
- API endpoints GET/POST /config/yolo for runtime control

Closes anomalyco#9070
Related: anomalyco#8463, anomalyco#7928, anomalyco#1813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: YOLO Mode - Skip Permission Prompts

3 participants